﻿using System.Collections;
using System.Collections.Generic;

namespace Innovator
{
	public class ComponentEnumerator : IEnumerator
	{
		int position = -1;
		ComponentCollection collection;
		List<int> ordered = new List<int>();

		public object Current
		{
			get { return collection[ordered[position]]; }
		}
		public ComponentEnumerator(ComponentCollection Collection, List<int> Order)
		{
			this.collection = Collection;
			this.ordered = Order;
		}
		public bool MoveNext()
		{
			++position;
			if (position == ordered.Count) return false;
			return true;
		}
		public IEnumerator GetEnumerator(){ return this; }
		public void Reset() { position = -1; }
	}
}
